package com.example.musicserver.model;

import lombok.Data;

@Data
public class Result<T> {
    private Integer status;
    private String message;
    private T data;


    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.status = 200;
        result.message = "";
        result.data = data;
        return result;
    }

    public static <T> Result<T> success(String message,T data) {
        Result<T> result = new Result<>();
        result.status = 200;
        result.message = message;
        result.data = data;
        return result;
    }

    public static <T> Result<T> fail(int status,String message,T data) {
        Result<T> result = new Result<>();
        result.status = status;
        result.message = message;
        result.data = data;
        return result;
    }

    public static <T> Result<T> fail(int status,String message) {
        Result<T> result = new Result<>();
        result.status = status;
        result.message = message;
        return result;
    }
}
